package com.chixing.day06;

public class Student {
    private String stuName;
    private int stuAge;
    private char stuGender;//性别
    // 无参构造函数，默认省略
    public Student(){
        System.out.println("Student的无参构造函数");

    }
    // 有参构造函数
    public Student(String stuName,int stuAge){ // new student("张三",20)
        this();
        this.stuName = stuName;
        this.stuAge = stuAge;
        }
// 构造函数之间的 调用 this()，this(...)
    public Student(String name,int age,char stuGender) {
        this(name, age);
        System.out.println("有参构造函数");
        this.stuGender = stuGender;
        }

    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public int getStuAge() {
        return stuAge;
    }

    public void setStuAge(int stuAge) {
        this.stuAge = stuAge;
    }

    public char getStuGender() {
        return stuGender;
    }

    public void setStuGender(char stuGender) {
        this.stuGender = stuGender;
    }

    /*
            public String toString(){
            String info="stuName="+this.stuName+",stuAge="
                    +this.stuAge+",gender="+this.stuGender;
            return info;
            }
             */
        public String toString(){
            return "stuName="+this.stuName+",stuAge="
                    +this.stuAge+",gender="+this.stuGender;
        }

}
